// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2005-1-6

#ifndef __CMD_DBLOG_H_SERVER_SVR_MAIN__
#define __CMD_DBLOG_H_SERVER_SVR_MAIN__

#pragma once

#include "msvr_user.h"
#include "msvr_chat.h"
#include "msvr_server.h"
#include "cmd_handler.h"
#include <common/svr_base/db_utility.h>

namespace JoyServer
{


// class CJoyAsyncCmdKickUser

class CJoyAsyncCmdDbLog : public CJoyAsyncObject
{
public:
public:
    CJoyMainRoom*   m_room;
    UINT    m_adminId;
    CString m_chatText;
    CString m_command;

    UINT    m_userId;
    CString m_username;
    CString m_nickname;
public:

    CJoyAsyncCmdDbLog(CJoyCmdHandler::CCommandContext& context)
    {
        CJoyMainUser* pAdmin = context.m_user;

        m_room      = pAdmin->m_room;
        m_adminId   = pAdmin->m_userId;
        m_command   = context.m_command;
        m_userId    = 0;
        m_chatText.SetString(context.m_chatMsg->m_text, context.m_chatMsg->GetTextLength());
    }

    bool LoadUserInfoByNick();
    bool LoadUserInfoByName();

    void ResponseAdmin(const char* pNote);

    virtual void OnExecute();
};



} // namespace JoyServer

#endif  // __CMD_DBLOG_H_SERVER_SVR_MAIN__